package clientGUI.user.Controllers.ISD;

import java.util.ArrayList;

import college.User;

import clientGUI.Controllers.Controller;
import clientserver.Client;
import clientserver.Packet;
import clientserver.QueryResult;

public class ISDUserInfoController extends Controller {

	private ArrayList<String> logins;
	
	public ISDUserInfoController(Client c) {
		
		client=c;
		logins= new ArrayList<String>();
		
		String q="SELECT * FROM users";
				Packet p= new Packet(q);
		QueryResult qr= (QueryResult) client.SendPacketAndWait(p);
		for(int i=0;i<qr.rowsize();i++)
		{
			logins.add(qr.getString("login"));
			qr.next();
		}
		
	}
	
	public ArrayList<String> getLogins()
	{
		return logins;
	}

public  String getUserInfo(String l)
{
	User u = new User();
	u.setClient(client);
	System.out.println(l);
	u.setLogin(l);
	u.loadfromdb();
	return u.toString();
}
}

